<?php
/**
 * FastApp.
 * 3/29/25
 * @Author deepsea
 * @Contact (telegram:deepsea159)
 */

namespace App\Hoenix\Api\Controller;

use App\Fastapp\Api\Controller\ApiController;
use App\Hoenix\Api\Service\SeedService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\PostMapping;
use Psr\Http\Message\ResponseInterface;

#[Controller(prefix: 'api/hoenix/seed')]
class SeedController extends ApiController
{
    #[Inject]
    public SeedService $service;

    #[PostMapping('addCloudResources')]
    public function addCloudResources(): ResponseInterface
    {
        $data = $this->validate([
            'title' => 'required|string',
            'desc' => 'required|string',
        ]);
        return $this->service->addCloudResources($data['title'], $data['desc']) ? $this->success() : $this->error();
    }
}